%q3
f = checkerboard(8);
PSF=fspecial('motion',8,45);
g = imfilter(f,PSF,'circular');
imshow(g);
for u=8:64
    for v=8:64
        PSF(u,v)=0;
    end
end

Hc=fft2(PSF);
H=fftshift(Hc);

Gc=fft2(g);
G=fftshift(Gc);
D=G ./ H;
M=ifftshift(D);
imgf=ifft2(M);
figure,imshow(abs(imgf),[]);